From 636ac86e9f5fd9dbc5d062d5394bd32eb2196e72 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Wed, 17 Jan 2018 03:57:23 +0100 Subject: [PATCH] babl: add a test iteration multiplier On my system many of the conversions got measured to costs of 3 4 and 5, these makes a big room for measurement errors, to increase reliability the tests are now run 4 times - making it a ranking of contenders with fewer collisions. This will slightly increase incurred delayed on search for conversions. --- babl/babl-fish-path.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c index eb10fe9..d387fa8 100644 --- a/babl/babl-fish-path.c +++ b/babl/babl-fish-path.c @@ -26,6 +26,8 @@ #define BABL_HARD_MAX_PATH_LENGTH 8 #define BABL_MAX_NAME_LEN 1024 +#define BABL_TEST_ITER 4 + #ifndef MIN #define MIN(a, b) (((a) > (b)) ? (b) : (a)) #endif @@ -926,7 +928,7 @@ init_path_instrumentation (FishPathInstrumentation *fpi, fpi->source, fpi->ref_destination, fpi->num_test_pixels); ticks_end = babl_ticks (); - fpi->reference_cost = ticks_end - ticks_start; + fpi->reference_cost = (ticks_end - ticks_start) * BABL_TEST_ITER; /* transform the reference destination buffer to RGBA */ _babl_process (fpi->fish_destination_to_rgba, @@ -1002,6 +1004,7 @@ get_path_instrumentation (FishPathInstrumentation *fpi, /* calculate this path's view of what the result should be */ ticks_start = babl_ticks (); + for (int i = 0; i < BABL_TEST_ITER; i ++) process_conversion_path (path, fpi->source, source_bpp, fpi->destination, dest_bpp, fpi->num_test_pixels); ticks_end = babl_ticks (); -- 2.30.2